package org.lboot.rbac.module.dept;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.hibernate.Hibernate;
import org.lboot.jpa.entity.LongBaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author kindear
 */
@Getter
@Setter
@RequiredArgsConstructor
@Entity
@Table(name = "sys_dept")
@ApiModel(value = "系统部门实体",description = "系统部门管理")
public class SysDept extends LongBaseEntity implements Serializable {
    /**
     * 父部门ID
     */
    @ApiModelProperty("父部门ID")
    @Column(name = "parent_id")
    Long parentId;
    /**
     * 部门名称
     */
    @ApiModelProperty("部门名称")
    @Column(name = "dept_name")
    String deptName;


    /** 显示顺序 */
    @ApiModelProperty("显示顺序")
    @Column(name = "dept_sort")
    private Integer deptSort;

    /** 负责人 */
    @ApiModelProperty("负责人")
    @Column(name = "leader")
    private String leader;

    /** 联系电话 */
    @ApiModelProperty("联系电话")
    @Column(name = "mobile")
    private String mobile;

    /** 邮箱 */
    @ApiModelProperty("负责人邮箱")
    @Column(name = "email")
    private String email;

    /** 部门状态:1正常,0停用 */
    @ApiModelProperty("部门状态")
    @Column(name = "status")
    private Integer status;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
            return false;
        }
        SysDept sysDept = (SysDept) o;
        return id != null && Objects.equals(id, sysDept.id);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
